package com.ssy.lingxi.member.merchant.model.bo;

import com.ssy.lingxi.member.merchant.utils.NumberUtil;

import java.io.Serializable;
import java.util.List;
import java.util.Objects;

/**
 * 用户数据权限配置BO，大致对应data-auth模块中的DataAuthDto的定义
 * @author 万宁
 * @version 2.0.0
 * @date 2021-04-12
 */
public class DataAuthBO implements Serializable {
    private static final long serialVersionUID = -7320607590057353100L;

    /**
     * 菜单url或code
     */
    private String url;

    /**
     * 登录来源
     */
    private Integer source;

    /**
     * 用户Id列表
     */
    private List<Long> userIds;

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public Integer getSource() {
        return source;
    }

    public void setSource(Integer source) {
        this.source = source;
    }

    public List<Long> getUserIds() {
        return userIds;
    }

    public void setUserIds(List<Long> userIds) {
        this.userIds = userIds;
    }

    public String quickEquals() {
        return url + source;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }

        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        DataAuthBO that = (DataAuthBO) o;
        return url.equals(that.url) && source.equals(that.source) && NumberUtil.listEqual(userIds, that.getUserIds());
    }

    @Override
    public int hashCode() {
        return Objects.hash(url, source);
    }
}
